//
//  HistoryCell.swift
//  onemeetingmac
//
//  Created by 张衡 on 2020/8/17.
//  Copyright © 2020 onemeeting. All rights reserved.
//

import Foundation

class HistoryCell: TableRowView {
    
    static let identifier = NSUserInterfaceItemIdentifier.init("HistoryCell")
    
    var isClear:Bool = false {
        didSet {
            self.stitle.textColor = isClear ? color_main140:color_gray(120)
            self.stitle.font = isClear ? NSFont.boldSystemFont(ofSize: 14):NSFont.systemFont(ofSize: 14)
            self.message.isHidden = isClear
        }
    }
    
    convenience init(identifier:NSUserInterfaceItemIdentifier) {
        self.init()
        self.setupUI()
    }
    
    override init(frame frameRect: NSRect) {
        super.init(frame: frameRect)
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    convenience init(type:ZHTabGroup,identifier:NSUserInterfaceItemIdentifier) {
        self.init()
        self.identifier = identifier
        self.setupUI()
    }
    
    func setupUI()  {
        self.focusRingType = .none
        
        self.addSubview(stitle)
        stitle.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(10)
            make.height.equalTo(20)
            make.centerY.equalToSuperview()
        }
        
        self.addSubview(message)
        message.snp.makeConstraints { (make) in
            make.right.equalToSuperview().offset(-10)
            make.height.equalTo(20)
            make.centerY.equalToSuperview()
        }
    }
    
    lazy var stitle: NSLabel = {
        let lab = NSLabel.label(title: "标题", textColor: color_gray(120), font: NSFont.systemFont(ofSize: 13))
        lab.sizeToFit()
        return lab
    }()
    
    lazy var message: NSLabel = {
        let lab = NSLabel.label(title: "...", textColor: color_gray(70), font: NSFont.systemFont(ofSize: 13))
        lab.alignment = .right
        lab.sizeToFit()
        return lab
    }()
    
}
